#ifndef MeshListWidget_h__
#define MeshListWidget_h__

#include "Fl/Fl_Menu_Item.H"
#include "Fl/Fl_Group.H"
#include "Fl/Fl_Button.H"
#include "Fl/Fl_Box.H"
#include "Fl/Fl_Scroll.H"
#include <vector>
#include <string>
class MeshView;
// a special widget to show the meshes loaded.  Has a button to toggle visibility,
// radio button to select the mesh, and a menu to do other commands.
class MeshListWidget : public Fl_Group
{
   public:
      MeshListWidget(int ax, int ay,int aw,int ah,const char * aLbl=0);
      void resize(int,int,int,int);
      static Fl_Menu_Item mMenu[12];
      struct Row
      {
         Row(MeshListWidget* aParent);
         void Update();
         MeshListWidget* mMeshListPtr;
         void Select();
         std::string mName;
         MeshView*   mMeshPtr;
         Fl_Group*   mGroup;
         Fl_Button*  mVisibility;
         Fl_Box*     mLabel;
         Fl_Button*  mSelector;
      };

      void UpdateRows();
      int GetSelected();
      void SelectRow(Row* aRow);
      void UpdateSelected();
   private:
      Row* CreateRow(MeshView* aMeshPtr);
      Row* FindRow(void* aMeshPtr);
      typedef std::vector<Row*> RowList;
      std::vector<Row*> mRows;
      Fl_Scroll* mScroll;
};

#endif // MeshListWidget_h__
